#include "server.h"

int main(int argc, char *argv[]){

    char *ip = "127.0.0.1";
    char *port = "8080";

    int socket_fd = socket(AF_INET, SOCK_STREAM, 0);

    struct sockaddr_in sockAddr;
    sockAddr.sin_family = AF_INET;
    sockAddr.sin_addr.s_addr = inet_addr(ip);
    sockAddr.sin_port = htons(atoi(port));

    int ret = bind(socket_fd, (struct sockaddr *)&sockAddr, sizeof(sockAddr));
    ERROR_CHECK(ret, -1, "bind");
    ret = listen(socket_fd, 10);
    ERROR_CHECK(ret, -1, "listen");


    net_disk_t *ndt;
    server_mysql_init(ndt);
    ndt->ser_fd = socket_fd;
    while(1){
    int num = login_register(ndt);
    if(num == 99){
        printf("successful\n");
        break;
    }
    if(num == 0){
        printf("successful\n");
    }
    printf("failed\n");
    }
    return 0;
}

